package com.example.edu.domain.query;

import com.example.edu.validate.PageGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author yanzhao
 * @date 2022/1/13 11:18
 * @since 1.0.0
 */
@Data
public class PageQuery implements Serializable {

    /**
     * 当前，页码
     */
    @NotNull(groups = {PageGroup.class}, message = "{page.pageNum.notnull}")
    @Min(groups = {PageGroup.class}, value = 1, message = "{page.pageNum.min}")
    private Integer pageNum;

    /**
     * 每页，显示数据条数
     */
    @NotNull(groups = {PageGroup.class}, message = "{page.pageSize.notnull}")
    @Range(groups = {PageGroup.class}, min = 1, max = 100, message = "{page.pageSize.range}")
    private Integer pageSize;
}
